package com.leyou.test1.Demo2;

import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

public class SortDemo {
    public static void main(String[] args) {
        List<String> strings = Arrays.asList("ww", "bb", "dd", "hh");
        for (String string : strings) {
            System.out.println(string);
        }
        System.out.println("================");
        Collections.sort(strings, new Comparator<String>() {
            @Override
            public int compare(String o1, String o2) {
                return o2.compareTo(o1);
            }
        });
        for (String s : strings) {
            System.out.println(s);
        }
    }
}
